package com.jack.lib.ui.init

import android.app.Application
import android.content.Context
import androidx.camera.camera2.Camera2Config
import androidx.camera.core.CameraXConfig
import com.jack.lib.ui.utils.PictureSelectorEngineImp
import com.luck.picture.lib.app.IApp
import com.luck.picture.lib.app.PictureAppMaster
import com.luck.picture.lib.engine.PictureSelectorEngine

/**
 * author : chong.huang
 * create : 2021/12/29
 * desc   :
 */
object CameraInitializer : IApp, CameraXConfig.Provider {

    lateinit var application: Application

    fun init(application: Application) {
        this.application = application

        initPicture()
    }

    private fun initPicture() {
        PictureAppMaster.getInstance().app = this
    }

    override fun getAppContext(): Context = application

    override fun getPictureSelectorEngine(): PictureSelectorEngine = PictureSelectorEngineImp()

    override fun getCameraXConfig(): CameraXConfig = Camera2Config.defaultConfig()
}